export default {
    setHeaderTitle(state,routerName){
        switch(routerName){
          case "DayPage":state.headerTitle="当天信息";
          break;
          case "MonthPage":state.headerTitle="当月信息";
          break;
          case 'YearPage':state.headerTitle='当年信息';
          break;
          default:state.headerTitle="当天信息";
          break;
        }
    },
    setMaxlength(state,routerName){
        switch(routerName){
            case "DayPage":state.maxlength=8;
            break;
            case "MonthPage":state.maxlength=6;
            break;
            case 'YearPage':state.maxlength=4;
            break;
            default:state.maxlength=8;
            break;
          }
    },
    setPlaceholder (state, routerName) {

        const date = new Date();
    
        let year = date.getFullYear(),
            month = date.getMonth() + 1,
            day = date.getDate();
        
        month = month < 10 ? '0' + month : month;
        day = day < 10 ? '0' + day : day;
    
        switch (routerName) {
          case "DayPage":
            state.placeholder = `格式：${year}${month}${day}（${year}年${month}月${day}日）`;
            break;
          case "MonthPage":
            state.placeholder = `格式：${year}${month}（${year}年${month}月）`;
            break;
          case "YearPage":
            state.placeholder = `格式：${year}（${year}年）`;
            break;
          default:
            state.placeholder = `格式：${year}${month}${day}（${year}年${month}月${day}日）`;
            break;
        }
      },
}